package eerbaar.v2.gamebuilder;

import java.util.UUID;

public class Config {

    private static String staticUserId;
    private static String staticServer;
    private static String staticAuth;

    public static String calcAuth() {

        return staticAuth;
    }

    public static String calcServer() {

        String s = staticServer; // System.getProperty("javaws.eerbaar.server");
        System.out.println("server=" + s);
        if (s != null && s.length() > 0) {
            s = "http://" + s + "/";
        } else {
            s = "http://localhost:8888/";
        }

        return s;
    }

    public static String calcUserId() {

        String s = staticUserId; // System.getProperty("javaws.eerbaar.userid");
        if (s == null) {
            s = UUID.randomUUID().toString();
        }
        if (s.contains("@") || s.length() == 0) {
            s = UUID.randomUUID().toString();
        }
        System.out.println("userid=" + s);

        return s;
    }

    public static void setCalcAuth(String auth) {
        staticAuth = auth;
    }

    public static void setCalcServer(String server) {
        staticServer = server;
    }

    public static void setCalcUserId(String id) {
        staticUserId = id;
    }

    private String server = "";
    private String client = "";

    private String userId = "";

    private String auth = "";

    public String getAuth() {
        return this.auth;
    }

    public String getClient() {
        return this.client;
    }

    public String getServer() {
        return this.server;
    }

    public String getUserId() {
        return this.userId;
    }

    public void setAuth(String auth) {
        this.auth = auth;
    }

    public void setClient(String client) {
        this.client = client;
    }

    public void setServer(String server) {
        this.server = server;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

}
